<?php
include_once "../header1.php";
?>
</head>
<body>
<?php
include_once ("../Login/databaseconnection.php");

if(!loggedin())
{
	require_once ("../index.php");
}   
   else
   {
	$School_Id=$_GET['School_Id'];
if(isset($_POST['Register']))
	   { 
 $Congeniality=$_POST['Congeniality'];
 $New_Congeniality=$_POST['New_Congeniality'];
 $Function=$_POST['Function'];
 $New_Function=$_POST['New_Function'];
 $Ethinicity=$_POST['Ethinicity'];
 $New_Ethinicity=$_POST['New_Ethinicity'];
 $Zone=$_POST['Zone'];
  $Division=$_POST['Division'];
$Province=$_POST['Province'];
  $District=$_POST['District'];
 $Name=$_POST['Name'];
   $Status=$_POST['Status'];
 $Type=$_POST['Type'];
   $Grade_Range=$_POST['Grade_Range'];
  $Medium=$_POST['Medium'];
  $Female_Students=$_POST['Female_Students'];
   $Male_Students=$_POST['Male_Students'];
   $Tp_Number=$_POST['Tp_Number'];
 $Fax_Number=$_POST['Fax_Number'];
  $E_Mail=$_POST['E_Mail'];
  $Web_Address=$_POST['Web_Address'];
  $Address=$_POST['Address'];
 $Account_Number=$_POST['Account_Number'];
$School_Id=$_POST['School_Id'];
$Census_Number=$_POST['Census_Number'];

	   if($Census_Number!="")
	   {
	   	$Sch_Che=mysql_query("SELECT * FROM school WHERE Census_Number='$Census_Number'");
if(mysql_num_rows($Sch_Che)>=1)
		{
			$_SESSION['errorexi']="Sorry this school's record already exists";
		}
		else
		{
			   	if($_SESSION['Access_Type']=="Administrator")
{
   require_once 'REG.php';
 }
 else if($_SESSION['Access_Type']=="Teacher in Charge")
{
   $NIC_Number=$_SESSION['NIC_Number'];
   $get_Sch=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$NIC_Number'");
   if($rowsch=mysql_fetch_array($get_Sch))
{
   $Own_School_Id=$rowsch['School_Id'];
   $get_Cen=mysql_query("SELECT * FROM school WHERE School_Id='$Own_School_Id'");
   if($rowcen=mysql_fetch_array($get_Cen))
   {
   $Own_Census_Number=$rowcen['Census_Number'];
   }
    if($Census_Number!=$Own_Census_Number)
	{
	$_SESSION['errornotallo']="Sorry you are not allowed to do this!";
	}
	 if($Census_Number==$Own_Census_Number)
	{
	require_once 'REG.php';
	}
	}
	else
	{
	$_SESSION['errornotallo']="First register as a teacher then try again!";
	}
	}
	   else
	   {
	   $_SESSION['errornotallo']="Sorry you are not allowed to do this!";
	   } 
   }	
	   }
	    if($Census_Number=="")
	   {
	   $_SESSION['errorcnu']="Please enter the Census number of the School,Indexed details are required!";
	   }
	  
	   }
	?><?php
include_once "../header2.php";
?>
<?php
include_once "topmenu.php";
?>
<div id="content">
	<div id="main">
	  <div id="bodyfield">


<form action="#" method="POST">
  <table width="922" border="0">
  <tr>
    <td height="18" colspan="10" align="left" scope="row">
    <?php
    if(isset($_POST['Register']))
{
	if(isset($_SESSION['error']))	
  {
  if($_SESSION['succ']="succ")
	{
echo '<font color="green">';
	echo '<img src="../images/tick.png" width="22" height="22"/>';
	}
	else
	{
echo '<font color="red">';
	echo '<img src="../images/alert.jpg" width="12" height="12"/>';
	}
		echo $_SESSION['error'];
		unset($_SESSION['error']);
	echo '</font>';	
	}
echo '<font color="red">';
if(isset($_SESSION['errorin']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['errorin'];
		unset($_SESSION['errorin']);
	}
	if(isset($_SESSION['errorexi']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['errorexi'];
		unset($_SESSION['errorexi']);
		
	}
	if(isset($_SESSION['errorcnu']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['errorcnu'];
		unset($_SESSION['errorcnu']);
		
	}
if(isset($_SESSION['errornotallo']))
{
echo '<img src="../images/alert.jpg" width="12" height="12"/>';
echo $_SESSION['errornotallo'];
unset($_SESSION['errornotallo']);
}

if(isset($_SESSION['errorspo']))
{
echo '<img src="../images/alert.jpg" width="12" height="12"/>';
echo $_SESSION['errorspo'];
unset($_SESSION['errorspo']);
}
echo '</font>';
}?></td>
    <td width="126" colspan="4">&nbsp;</td>
  </tr>
  </table>
  <table width="1310" class="tablefontv">  
  <tr>
    <th width="7" rowspan="15" align="left" scope="row"">&nbsp;</th>
    <td width="9" scope="row" align="left"><font color="red" size="+2"><p align="center">*</p></font></td>
    <th width="141" height="32" scope="row" align="left"> <label>Census Number</label></th>
    <th width="10" scope="row" align="left">:-</th>
    <td width="52"><?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Census_Number' value='$Census_Number'/>";
echo '</td>';

}
else
{
echo "<input type='text' name='Census_Number'/>";
echo '</td>';
}
?></td>
    <td width="12">&nbsp;</td>
    <td width="12"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td width="110">School Status</td>
    <td width="9">:-</td>
    <td width="213">
	<?php
	   if(isset($_POST['Register']))
{
	if($Status=="National")
	  {
	    echo '<input type="radio" name="Status" value="National" id="Status_0" checked="checked" />';
	   echo "National";
	  }
	  else
	  {
		  echo '<input type="radio" name="Status" value="National" id="Status_0" />';
	   echo "National";
	  }
        echo '<br />';
        if($Status=="Provincial")
		{
          echo '<input type="radio" name="Status" value="Provincial" id="Status_1" checked="checked" />';
          echo "Provincial";
  }
  else
  {
	   echo '<input type="radio" name="Status" value="Provincial" id="Status_1" />';
          echo "Provincial";
  }
  }
  else
  {
  ?>
	<label>
      <input type="radio" name="Status" value="National" id="Status_0" />
      National</label>
      <br />
      <label>
        <input type="radio" name="Status" value="Provincial" id="Status_1" />
        Provincial</label>
		<?php
		}
		?></td>
    <td width="9">&nbsp;</td>
    <td width="16">&nbsp;</td>
    <td width="135" height="32"><label for="textfield">Telephone Number</label></td>
    <td width="14"><strong>:-</strong></td>
    <td width="202"><?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Tp_Number' value='$Tp_Number'/>";
echo '</td>';

}
else
{

echo "<input type='text' name='Tp_Number'/>";
echo '</td>';

}?></td>
    <td width="9">&nbsp;</td>
    <td width="8">&nbsp;</td>
    <td width="116">&nbsp;</td>
    <td width="10">&nbsp;</td>
    <td width="145">&nbsp;</td>    
  </tr>
  <tr>
    <th scope="row" align="left">&nbsp;</th>
    <th height="10" scope="row" align="left">&nbsp;</th>
    <th scope="row" align="left">&nbsp;</th>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td height="10">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    
    </tr>
  <tr>
    <td scope="row" align="left"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="29" scope="row" align="left"> <label>School Name </label>
    </td>
    <th scope="row" align="left">:-</th>
    <td><?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Name' value='$Name'/>";
echo '</td>';

}
else
{

echo "<input type='text' name='Name'/>";
echo '</td>';

}?></td>
    <td>&nbsp;</td>
    <td><font color="red" size="+2"><p align="center">*</p></font></td>
    <td>School Type</td>
    <td>:-</td>
    <td><?php
	   if(isset($_POST['Register']))
{
	if($Type=="1AB")
	 {
       echo '<input type="radio" name="Type" value="1AB" id="Type_0" checked="checked" />';
       echo "1AB";
	 }
      
	   else
	   {
		   echo '<input type="radio" name="Type" value="1AB" id="Type_0" />';
       echo "1AB";} 
	    echo '<br />';
        if($Type=="1C")
	 {
         echo '<input type="radio" name="Type" value="1C" id="Type_1" checked="checked" />';
         echo "1C";
	 }
	 else
	 {
		  echo '<input type="radio" name="Type" value="1C" id="Type_1" />';
         echo "1C";
	 }
       echo '<br />';
       
	     if($Type=="2")
	 {
         echo '<input type="radio" name="Type" value="2" id="Type_2" checked="checked" />';
         echo "2";
	 } else
	 {
		  echo '<input type="radio" name="Type" value="2" id="Type_2" />';
         echo "2";
	 }
       echo '<br />';
      if($Type=="3")
	  { 
         echo '<input type="radio" name="Type" value="3" id="Type_3" checked="checked" />';
         echo "3";
	  }
		  else
	 {
		 echo '<input type="radio" name="Type" value="3" id="Type_3" />';
         echo "3";
	 }
	 }
	 else
	 {
	 ?>
	<label>
      <input type="radio" name="Type" value="1AB" id="Type_0" />
      1AB</label>
      <br />
      <label>
        <input type="radio" name="Type" value="1C" id="Type_1" />
        1C</label>
      <br />
      <label>
        <input type="radio" name="Type" value="2" id="Type_2" />
        2</label>
      <br />
      <label>
        <input type="radio" name="Type" value="3" id="Type_3" />
        3</label>
		<?php
		}
		?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td height="29"><label for="textfield2">Fax Number</label></td>
    <td><strong>:-</strong></td>
    <td><?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Fax_Number' value='$Fax_Number'/>";
echo '</td>';

}
else
{

echo "<input type='text' name='Fax_Number'/>";
echo '</td>';

}?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    
    </tr>
  <tr height="10">
    <th align="left" scope="row">&nbsp;</th>
    <th height="10" align="left" scope="row">&nbsp;</th>
    <th scope="row">&nbsp;</th>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td height="10">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    
    </tr>
  <tr>
    <td align="left" scope="row"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="29" align="left" scope="row"> <label>School Address </label>
    </td>
    <th scope="row">:-</th>
    <td><?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Address' value='$Address'/>";
echo '</td>';

}
else
{

echo "<input type='text' name='Address'/>";
echo '</td>';

}?></td>
    <td rowspan="2">&nbsp;</td>
    <td rowspan="2"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td rowspan="2">Grade Range</td>
    <td rowspan="2">:-</td>
    <td rowspan="2">
	<?php
	   if(isset($_POST['Register']))
{
 if($Grade_Range=="1-5")
	  {
        echo '<input type="radio" name="Grade_Range" value="1-5" id="Grade_Range_0" checked="checked" />';
        echo "1-5";
	  }
	  else
	  {
		  echo '<input type="radio" name="Grade_Range" value="1-5" id="Grade_Range_0" />';
        echo "1-5";
	  }
	   echo '<br />';
	  if($Grade_Range=="1-11")
	  {
       
        echo '<input type="radio" name="Grade_Range" value="1-11" id="Grade_Range_3" checked="checked" />';
          echo "1-11";
		  }
	  else
	  {
		  echo '<input type="radio" name="Grade_Range" value="1-11" id="Grade_Range_3" />';
          echo "1-11";
	  }
        echo '<br />';
		if($Grade_Range=="1-13")
		{
       echo '<input type="radio" name="Grade_Range" value="1-13" id="Grade_Range_4" checked="checked" />';
          echo "1-13";
        }
	  else
	  {
		   echo '<input type="radio" name="Grade_Range" value="1-13" id="Grade_Range_4" />';
          echo "1-13";
	  }
        echo '<br />';
       
       if($Grade_Range=="6-11")
	   {   echo '<input type="radio" name="Grade_Range" value="6-11" id="Grade_Range_1" checked="checked" />';
          echo "6-11";
		  }
	  else
	  {
		  echo '<input type="radio" name="Grade_Range" value="6-11" id="Grade_Range_1" />';
          echo "6-11";
	  }
		 echo '<br />';
       if($Grade_Range=="6-13")
	   {
          echo '<input type="radio" name="Grade_Range" value="6-13" id="Grade_Range_2" checked="checked" />';
          echo "6-13";
		  }
	  else
	  {
		  echo '<input type="radio" name="Grade_Range" value="6-13" id="Grade_Range_2" />';
          echo "6-13";
	  }
		echo '<br />';
		if($Grade_Range=="Others")
		{
        echo '<input type="radio" name="Grade_Range" value="Others" id="Grade_Range_5" checked="checked" />';
          echo "Others";
		}
	  else
	  {
		  echo '<input type="radio" name="Grade_Range" value="Others" id="Grade_Range_5" />';
          echo "Others";
	  }
	  }
	  else
	  {
	  ?>
	<label>
      <input type="radio" name="Grade_Range" value="1-5" id="Grade_Range_0" />
      1-5</label>
      <br />
      <label>
        <input type="radio" name="Grade_Range" value="1-11" id="Grade_Range_3" />
        1-11</label>
      <br />
      <label>
        <input type="radio" name="Grade_Range" value="1-13" id="Grade_Range_4" />
        1-13</label>
      <label> </label>
      <br />
      <label>
        <input type="radio" name="Grade_Range" value="6-11" id="Grade_Range_1" />
        6-11</label>
      <br />
      <label>
        <input type="radio" name="Grade_Range" value="6-13" id="Grade_Range_2" />
        6-13</label>
      <br />
      <label>
        <input type="radio" name="Grade_Range" value="Others" id="Grade_Range_5" />
        Others</label>
		<?php
		}
		?></td>
    <td rowspan="2">&nbsp;</td>
    <td rowspan="2">&nbsp;</td>
    <td height="29" rowspan="2"><label for="textfield3">Email Address</label></td>
    <td rowspan="2"><strong>:-</strong></td>
    <td rowspan="2"><?php
	   if(isset($_POST['Register']))
{

echo "<input type='email' name='E_Mail' value='$E_Mail'/>";
echo '</td>';

}
else
{

echo "<input type='email' name='E_Mail'/>";
echo '</td>';

}?></td>
    <td rowspan="2">&nbsp;</td>
    <td rowspan="2">&nbsp;</td>
    
    </tr>
  <tr>
    <th align="left" scope="row"><font color="red" size="+2"><p align="center">*</p></font></th>
    <th height="28" align="left" scope="row"><label>School ID </label></th>
    <th scope="row">:-</th>
    <td><?php
	   if(isset($_POST['Register'])||isset($_GET['School_Id']))
{
if(isset($_GET['School_Id']))
{
$School_Id=$_GET['School_Id'];
}
echo "<input type='text' name='School_Id' value='$School_Id'/>";
echo '</td>';
}
else
{
if($School_Id!="")
{
echo "<input type='text' name='School_Id' value='$School_Id'/>";
}
else
{
echo "<input type='text' name='School_Id'/>";
}
echo '</td>';
}
?></td>
    
    </tr>
  <tr height="10">
    <th align="left" scope="row">&nbsp;</th>
    <th height="10" align="left" scope="row">&nbsp;</th>
    <th scope="row">&nbsp;</th>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td height="10">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    
    </tr>
  <tr>
    <td align="left" scope="row"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="27" align="left" scope="row"> <label>Division</label>
    </td>
    <th scope="row">:-</th>
    <td><?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Division' value='$Division'/>";
echo '</td>';

}
else
{

echo "<input type='text' name='Division'/>";
echo '</td>';

}?></td>
    <td>&nbsp;</td>
    <td><font color="red" size="+2"><p align="center">*</p></font></td>
    <td>Medium</td>
    <td>:-</td>
    <td> 
	<?php
	   if(isset($_POST['Register']))
	   {
	if($Medium =="Tamil")
	  {
        echo '<input type="radio" name="Medium" value="Tamil" id="Medium_0" checked="checked" />';
       echo "Tamil";
	   }else
	   {
		   echo '<input type="radio" name="Medium" value="Tamil" id="Medium_0" />';
       echo "Tamil";
	   }
        echo '<br />';
		if($Medium=="English")
	  {
        echo '<input type="radio" name="Medium" value="English" id="Medium_1" checked="checked" />';
          echo "English";
	  }else
	  {
		  echo '<input type="radio" name="Medium" value="English" id="Medium_1" />';
          echo "English";
	  }
        echo '<br />';
		if($Medium=="Mix(Tamil & English)")
	  {
        echo '<input type="radio" name="Medium" value="Mix(Tamil &amp; English)" id="Medium_2" checked="checked" />';
          echo "Mix(Tamil &amp; English)";
	  }
		  else
		  {
			  echo '<input type="radio" name="Medium" value="Mix(Tamil &amp; English)" id="Medium_2" />';
          echo "Mix(Tamil &amp; English)";
		  }
        echo '<br />';
		if($Medium=="Sinhala")
	  {
        echo '<input type="radio" name="Medium" value="Sinhala" id="Medium_3" checked="checked" />';
          echo "Sinhala";
	  }else
	  {
		   echo '<input type="radio" name="Medium" value="Sinhala" id="Medium_3" />';
          echo "Sinhala";
	  }
        echo '<br />';
		if($Medium=="Mix(Tamil &amp; Sinhala)")
	  {
       echo '<input type="radio" name="Medium" value="Mix(Tamil &amp; Sinhala)" id="Medium_4" checked="checked" />';
          echo "Mix(Tamil &amp; Sinhala)";
	  }else
	  {
		  echo '<input type="radio" name="Medium" value="Mix(Tamil &amp; Sinhala)" id="Medium_4" />';
          echo "Mix(Tamil &amp; Sinhala)";
	  }
        echo '<br />';
		if($Medium=="Mix(Tamil,English &amp; Sinhala)")
	  {
        echo '<input type="radio" name="Medium" value="Mix(Tamil,English &amp; Sinhala)" id="Medium_5" checked="checked" />';
         echo "Mix(Tamil,English &amp; Sinhala)";
	  }else
	  {
		   echo '<input type="radio" name="Medium" value="Mix(Tamil,English &amp; Sinhala)" id="Medium_5" />';
         echo "Mix(Tamil,English &amp; Sinhala)";
	  }
	  }
	  else{
	  ?>
	<label>
      <input type="radio" name="Medium" value="Tamil" id="Medium_0" />
      Tamil</label>
      <br />
      <label>
        <input type="radio" name="Medium" value="English" id="Medium_1" />
        English</label>
      <br />
      <label>
        <input type="radio" name="Medium" value="Mix(Tamil &amp; English)" id="Medium_2" />
        Mix(Tamil &amp; English)</label>
      <br />
      <label>
        <input type="radio" name="Medium" value="Sinhala" id="Medium_3" />
        Sinhala</label>
      <br />
      <label>
        <input type="radio" name="Medium" value="Mix(Tamil &amp; Sinhala)" id="Medium_4" />
        Mix(Tamil &amp; Sinhala)</label>
      <br />
      <label>
        <input type="radio" name="Medium" value="Mix(Tamil,English &amp; Sinhala)" id="Medium_5" />
        Mix(Tamil,English &amp; Sinhala)</label>
		<?php
		}
		?>
		</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td height="27"><label for="textfield4">Web Address</label></td>
    <td><strong>:-</strong></td>
    <td>
	
	<?php
	
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Web_Address' value='$Web_Address'/>";
echo '</td>';

}
else
{

echo "<input type='text' name='Web_Address'/>";
echo '</td>';

}?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    
    </tr>
  <tr>
    <td align="left" scope="row"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="37" align="left" scope="row"> <label></label>
      Zone </td>
    <th scope="row">:-</th>
    <td><?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Zone' value='$Zone'/>";
echo '</td>';

}
else
{

echo "<input type='text' name='Zone'/>";
echo '</td>';

}?></td>
    <td>&nbsp;</td>
    <td><font color="red" size="+2"><p align="center">*</p></font></td>
    <td>Principal Name</td>
    <td>:-</td>
    <td><?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Principal_Name' value='$Principal_Name'/>";
echo '</td>';

}
else
{

echo "<input type='text' name='Principal_Name'/>";
echo '</td>';

}?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>Special projects</td>
	    <td><strong>:-</strong></td>
    <td>	
<?php
$All_Special_Projects=="";
$OLPC="";
$Interactive_Whiteboard="";
$Isuru="";
$Navodaya="";
$E_village="";
$Tho_School_Dev="";
$Child_friendly_school="";
$all_S_P=mysql_query("SELECT DISTINCT(Special_Projects) FROM school");
while($r_sp=mysql_fetch_array($all_S_P))
{
$sp_exists="";
$each_sp=explode(",",$r_sp['Special_Projects']);
$All_SProjects=explode(",",$All_Special_Projects);
for($spr=0;$spr<count($each_sp);$spr++)
{
if($each_sp[$spr]!="")
{
if(substr($each_sp[$spr],0,6)=="other_")
{
$each_sp[$spr]=substr($each_sp[$spr],6);
}
if($each_sp[$spr]=="OLPC")
{
$OLPC="exists";
}
else if($each_sp[$spr]=="Interactive Whiteboard")
{
$Interactive_Whiteboard="exists";
}
else if($each_sp[$spr]=="Isuru")
{
$Isuru="exists";
}
else if($each_sp[$spr]=="Navodaya")
{
$Navodaya="exists";
}
else if($each_sp[$spr]=="E-village")
{
$E_village="exists";
}
else if($each_sp[$spr]=="1000 School Dev")
{
$Tho_School_Dev="exists";
}
else if($each_sp[$spr]=="Child friendly school")
{
$Child_friendly_school="exists";
}
for($s=0;$s<count($All_SProjects);$s++)
{
if($each_sp[$spr]==$All_SProjects[$s])
{
$sp_exists="yes";
break;
}
}
if($sp_exists!="yes")
{
if(empty($All_Special_Projects))
{
$All_Special_Projects=$each_sp[$spr];
}
else
{
$All_Special_Projects=$All_Special_Projects.",".$each_sp[$spr];
}
}
}
}
}
if($OLPC!="exists")
{
if(empty($All_Special_Projects))
{
$All_Special_Projects="OLPC";
}
else
{
$All_Special_Projects=$All_Special_Projects.",OLPC";
}
  }
  if($Interactive_Whiteboard!="exists")
{
if(empty($All_Special_Projects))
{
$All_Special_Projects="Interactive Whiteboard";
}
else
{
$All_Special_Projects=$All_Special_Projects.",Interactive Whiteboard";
}
   }
   if($Isuru!="exists")
{
if(empty($All_Special_Projects))
{
$All_Special_Projects="Isuru";
}
else
{
$All_Special_Projects=$All_Special_Projects.",Isuru";
}
   }
     if($Navodaya!="exists")
{
if(empty($All_Special_Projects))
{
$All_Special_Projects="Navodaya";
}
else
{
$All_Special_Projects=$All_Special_Projects.",Navodaya";
}
   }
     if($E_village!="exists")
{
if(empty($All_Special_Projects))
{
$All_Special_Projects="E-village";
}
else
{
$All_Special_Projects=$All_Special_Projects.",E-village";
}
   }
     if($Tho_School_Dev!="exists")
{
if(empty($All_Special_Projects))
{
$All_Special_Projects="1000 School Dev";
}
else
{
$All_Special_Projects=$All_Special_Projects.",1000 School Dev";
}
   }
   if($Child_friendly_school!="exists")
{
if(empty($All_Special_Projects))
{
$All_Special_Projects="Child friendly school";
}
else
{
$All_Special_Projects=$All_Special_Projects.",Child friendly school";
}
}
$All_Spe_Projects=explode(",",$All_Special_Projects);
$other="";
echo '<div style="width:180px; height:150px; overflow-Y:scroll; ">';
if(isset($_POST['Register']))
{
if($Special_Projects!="")
{
$S_Proje= explode(",",$S_Pro);
for($s=0;$s<count($All_Spe_Projects);$s++)
{
$S_Proj="";
for($i=0;$i<count($S_Proje);$i++)
{
if($S_Proje[$i]==$All_Spe_Projects[$s])
{
$S_Proj="yes";
}
}
if($S_Proj=="yes")
{
echo "<input type='checkbox' name='Special_Projects[]' value='$All_Spe_Projects[$s]' checked='checked'/>";
  echo $All_Spe_Projects[$s];
    echo '<br/>';
  }
  else if($S_Proj=="")
  {
echo "<input type='checkbox' name='Special_Projects[]' value='$All_Spe_Projects[$s]'/>";
  echo $All_Spe_Projects[$s];
    echo '<br/>';
  }
else if(substr($All_Spe_Projects[$s],0,6)=="other_")
  {
  $other="exists";
    $sp=substr($All_Spe_Projects[$s],6);
	if($sp!="")
	{
echo "<input type='checkbox' name='Special_Projects[]' value='Others(P1.specify)' checked='checked'/>";
echo "Others";
  echo '<br/>';
  }
  else
  {
echo "<input type='checkbox' name='Special_Projects[]' value='Others(P1.specify)'/>";
echo "Others";
  echo '<br/>';
  }
?>
<textarea name='Special_Projects_Others'><?php echo $sp." "; ?></textarea>
<?php
}
}
if($other!="exists")
{
echo "<input type='checkbox' name='Special_Projects[]' value='Others(P1.specify)'/>";
echo "Others";
  echo '<br/>';
 ?>
<textarea name='Special_Projects_Others'></textarea>
<?php
}
}
else
{
for($sp=0;$sp<count($All_Spe_Projects);$sp++)
{
echo "<input type='checkbox' name='Special_Projects[]' value='$All_Spe_Projects[$sp]'/>";
echo "$All_Spe_Projects[$sp]";
echo '<br/>';
}
echo "<input type='checkbox' name='Special_Projects[]' value='Others(P1.specify)'/>";
echo "Others:";
  echo '<br/>';
echo "<textarea name='Special_Projects_Others'></textarea>";
}
}
else
{
for($sp=0;$sp<count($All_Spe_Projects);$sp++)
{
echo "<input type='checkbox' name='Special_Projects[]' value='$All_Spe_Projects[$sp]'/>";
echo "$All_Spe_Projects[$sp]";
echo '<br/>';
}
echo "<input type='checkbox' name='Special_Projects[]' value='Others(P1.specify)'/>";
echo "Others:";
  echo '<br/>';
echo "<textarea name='Special_Projects_Others'></textarea>";
}
?>
	</div></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    
    </tr>
  <tr>
    <td align="left" scope="row"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="24" align="left" scope="row"> <label>District</label>
    </td>
    <th scope="row">:-</th>
    <td><?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='District' value='$District'/>";


}
else
{

echo "<input type='text' name='District'/>";


}?></td>
    <td>&nbsp;</td>
    <td><font color="red" size="+2"><p align="center">*</p></font></td>
    <td><label>Congeniality</label>
    </td>
    <th>:-</th>
    <td>
  <select name="Congeniality" id="Congeniality">
        <?php
		 if(isset($_POST['Register']))
	  {
	 echo '<option value="'.$Congeniality.'">'.$Congeniality.'</option>';
	  }
	  else
	  {
	  echo '<option value="Select One">Select One</option>';
	  }
	  	  $con=mysql_query("SELECT DISTINCT(Congeniality) FROM school");
	  
  while($row=mysql_fetch_array($con))
  {
	 $Cong=$row['Congeniality'];
if($Cong!=$Congeniality)
{
	  echo '<option value="'.$Cong.'">'.$Cong.'</option>';
}
  }
 
	  ?>
      </select>
	  </td><td><label><font color="red">or</font> New congeniality:&nbsp;&nbsp;&nbsp;</label>
	  <?php
	  if($New_Congeniality!="")
	  {
	  echo "<input type='text' name='New_Congeniality' value='$New_Congeniality'/>";
	  }
	  else
	  {
	  echo "<input type='text' name='New_Congeniality'/>";
	  }
	  ?>
	  </td>
	<td><font color="red" size="+2"><p align="center">*</p></font></td>
    <td> <label>Ethinicity</label>
    </td>
    <th>:-</th>
    <td>
  <select name="Ethinicity" id="Ethinicity">
        <?php
		 if(isset($_POST['Register']))
	  {
	 echo '<option value="'.$Ethinicity.'">'.$Ethinicity.'</option>';
	  }
	  else
	  {
	  echo '<option value="Select One">Select One</option>';
	  }
	  	  $eth=mysql_query("SELECT DISTINCT(Ethinicity) FROM school");
	  
  while($row=mysql_fetch_array($eth))
  {
	 $Ethni=$row['Ethinicity'];
if($Ethni!=$Ethinicity)
{
	  echo '<option value="'.$Ethni.'">'.$Ethni.'</option>';
}
  }
 
	  ?>
      </select>
	  </td><td><label><font color="red">or</font> New ethinicity:&nbsp;&nbsp;&nbsp;</label>
	  <?php
	  if($New_Ethinicity!="")
	  {
	  echo "<input type='text' name='New_Ethinicity' value='$New_Ethinicity'/>";
	  }
	  else
	  {
	  echo "<input type='text' name='New_Ethinicity'/>";
	  }
	  ?>
	  </td>
    <td>&nbsp;</td> 
    </tr>
  <tr>
    <td align="left" scope="row"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="22" align="left" scope="row"><label>Province</label></td>
    <th scope="row">:-</th>
    <td><?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Province' value='$Province'/>";


}
else
{

echo "<input type='text' name='Province'/>";


}?></td>
    <td>&nbsp;</td>
<td><font color="red" size="+2"><p align="center">*</p></font></td>
    <td> <label>Function</label>
    </td>
    <th>:-</th>
    <td>
  <select name="Function" id="Function">
        <?php
		 if(isset($_POST['Register']))
	  {
	 echo '<option value="'.$Function.'">'.$Function.'</option>';
	  }
	  else
	  {
	  echo '<option value="Select One">Select One</option>';
	  }
	  	  $func=mysql_query("SELECT DISTINCT(Function) FROM school");
	  
  while($row=mysql_fetch_array($func))
  {
	 $Fun=$row['Function'];
if($Fun!=$Function)
{
	  echo '<option value="'.$Fun.'">'.$Fun.'</option>';
}
  }
 
	  ?>
      </select>
	  </td><td><label><font color="red">or</font> New functioning state:&nbsp;&nbsp;&nbsp;</label>
	  <?php
	  if($New_Function!="")
	  {
	  echo "<input type='text' name='New_Function' value='$New_Function'/>";
	  }
	  else
	  {
	  echo "<input type='text' name='New_Function'/>";
	  }
	  ?>
	  </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    
    </tr>
  <tr>
    <td align="left" scope="row"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="29" align="left" scope="row">Number of Students</td>
    <th scope="row">:-</th>
    <td colspan="9"><label for="Male4">Male</label>
      <strong>:</strong>
    <?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Male_Students' value='$Male_Students'/>";


}
else
{

echo "<input type='text' name='Male_Students'/>";


}?>
      <label for="Female5">Female:</label>
	  <?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Female_Students' value='$Female_Students'/>";


}
else
{

echo "<input type='text' name='Female_Students'/>";


}?>
      </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    
    </tr>
  <tr>
    <td height="24" align="left" scope="row">&nbsp;</td>
    <td height="24" align="left" scope="row">Account Number</td>
    <th height="24" align="left" scope="row">:-</th>
    <td height="24" align="left" scope="row"><?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Account_Number' value='$Account_Number'/>";
echo '</td>';

}
else
{

echo "<input type='text' name='Account_Number'/>";
echo '</td>';

}?></td>
    <td height="24" align="left" scope="row">&nbsp;</td>
    <td height="24" align="left" scope="row">&nbsp;</td>
    <td height="24" align="left" scope="row">&nbsp;</td>
    <td height="24" align="left" scope="row">&nbsp;</td>
    <td height="24" align="left" scope="row">
	<a href="AddSch.php" class="reset">Reset</a>|
<input name="Register" align="middle" type="submit" value="Register" class="buttonok"/></td>
    <td height="24" align="left" scope="row">
	<?php
if($_SESSION['succ']="succ")
	{
	echo '<a href="../Programmes/RegPro.php?s='.$School_Id.'" target="_blank">';
	echo '<input name="Register_Programmes" align="middle" type="button" value="Register Programmes" class="regbutton"/>';
    }
	?>
	</td>
    <td height="24" align="left" scope="row">
	<?php
if($_SESSION['succ']="succ")
	{
	echo '<a href="../Lab/RegLab.php?s='.$School_Id.'" target="_blank">';
	echo '<input name="Register_Labs" align="middle" type="button" value="Register Labs" class="regbutton"/></a>';
    }
	?></td>
    <td height="24" align="left" scope="row">&nbsp;</td>
    <td height="24" align="left" scope="row">&nbsp;</td>
    <td height="24" align="left" scope="row">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    
  </tr>
  <tr>
    <th height="18" colspan="19" align="left" scope="row">&nbsp;</th>
    </tr>
  </table>
  </form>
</div>
</div>
</div>
<div id="sidebar">
<br/>
<div id="partners" class="boxed">
			<h2 class="title">SCHOOLS</h2>
            </div>
<?php
include_once "menu.php";
?>
 <?php
include_once "../footer.php";
?>
<?php
	}

?>
</body>
</html>